#pragma once

#include "UIWindowBase.h"
class CUIGridImgPlus;

class COOLUI_CLASS CUIControl : public CUIWindowBase
{
public:
    CUIControl( HWND hWnd );
    virtual ~CUIControl();

    LRESULT ProcessUIMsg( UINT uMsg, WPARAM wParam, LPARAM lParam );

    BOOL IsFocused();
    BOOL IsEnable();
    UINT GetCtrlID();
    BOOL IsPress()const;
    BOOL IsHot()const;
    BOOL IsChecked();
    void LoadImage( LPCTSTR lpszImg, IMGDIRECTION imgDir = IMG_HOR, UINT imgCount = 1 );
    void SetTextColor( COLORREF clrText );
    void SetFillColor( COLORREF clrFill );
    void SetBorderColor( COLORREF clrBorder );
    void Redraw();
    void ParentReDrawPart();
    void GetButtonRect( RECT& rect );
    virtual void OnDraw( HDC hDC ) = 0;
    void OnPaint();
protected:
    LRESULT OnLButtonDown( WPARAM wParam, LPARAM lParam );
    LRESULT OnLButtonUp( WPARAM wParam, LPARAM lParam );
    LRESULT OnMouseMove( WPARAM wParam, LPARAM lParam );
    LRESULT OnMouseLeave( WPARAM wParam, LPARAM lParam );
    void SetPresss( BOOL bPress );
    void SetHot( BOOL bHot );
    void SetTransparent( BOOL bTransparent = TRUE );
    CUIGridImgPlus* GetImage();
    COLORREF GetTextColor();
    COLORREF GetFillColor();
    COLORREF GetBorderColor();
    HBRUSH GetFillBrush();
private:
    BOOL m_bPressed;
    BOOL m_bHot;
    CUIGridImgPlus* m_pImg;
    COLORREF m_clrText;
    COLORREF m_clrFill;
    COLORREF m_clrBorder;
    HBRUSH m_brushFill;
};

